package cn.wj.school.cloud.service;

import cn.wj.school.cloud.dao.SyEcodeMapper;
import cn.wj.school.cloud.dto.SyEcodeDTO;
import cn.wj.school.cloud.utils.BeanCopyUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @Author: yueding
 * @Description:
 * @Date: Created in 16:32 2019/1/15
 * @Modified By: yueding
 * Copyright(c) cai-inc.com
 */
@Service
public class EcodeServiceImpl implements EcodeService {

    @Autowired
    private SyEcodeMapper syEcodeMapper;
    /**
     * 获取某个类型下面的代码
     *
     * @param type
     * @return
     */
    @Override
    public List<SyEcodeDTO> getEcodesByType(String type) {
        if (StringUtils.isEmpty(type)){
            return Collections.emptyList();
        }
        return BeanCopyUtil.genBeanList(syEcodeMapper.selectByEcodeType(type), SyEcodeDTO.class);
    }

    /**
     * 保存
     *
     * @param ecode
     */
    @Override
    public void saveEcode(SyEcodeDTO ecode) {

    }

    /**
     * 修改
     *
     * @param ecode
     */
    @Override
    public void modifyEcode(SyEcodeDTO ecode) {

    }

    /**
     * 删除
     *
     * @param id
     */
    @Override
    public void removeEcode(Long id) {

    }
}
